package com.bailiban.base.controller;

import com.bailiban.common.entity.Result;
import com.bailiban.common.entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName BaseExcceptionController
 * @Description TODO
 * @Author ThinkPad
 * @Date 2020/11/17 11:04
 * @Version 1.0
 **/
@ControllerAdvice
public class BaseExcceptionController {

    @ExceptionHandler
    @ResponseBody
    public Result exception(Exception e){
        return new Result(false, StatusCode.ERROR,e.getMessage());
    }
}
